package edu.gxnu.cetcdemo.controller;

import edu.gxnu.cetcdemo.pojo.TDuty;
import edu.gxnu.cetcdemo.service.TDutyService;
import edu.gxnu.cetcdemo.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/duty")
public class TDutyController {
    @Autowired
    private TDutyService tDutyService;

    @ApiOperation("浏览值班表接口")
    @GetMapping("")
    public Result queryTDuty(){
        return tDutyService.queryTDuty();
    }

    @ApiOperation("添加值班表信息接口")
    @PostMapping("")
    public Result addTDuty(@RequestBody TDuty tDuty){
        return tDutyService.addTDuty(tDuty);
    }

    @ApiOperation("更新值班表信息接口")
    @PutMapping("")
    public Result updateTDuty(@RequestBody TDuty tDuty){
        return tDutyService.updateTDuty(tDuty);
    }

    @ApiOperation("删除值班表信息接口")
    @DeleteMapping("/{duty_id}")
    public Result delTDuty(@PathVariable long duty_id){
        return tDutyService.delTDuty(duty_id);
    }
}
